import { defaultImageUrl } from '@/utils';
import { GET, POST } from '@/service';
import http from '@/service';
/**
 * 查询全部银行列表
 */
export const getbankList = (otherParams) => {
	const url = '/api/userInfo/bank/all/list';

	return GET(url, otherParams);
};

/**
 * 开户行列表
 */
export const getAccountList = (otherParams) => {
	const url = '/api/userInfo/bank/account/list';

	return GET(url, otherParams);
};

/**
 * 获取【我的】银行卡列表
 */
export const getMyBankList = (otherParams) => {
	const url = '/api/userInfo/user/bank/list';

	return GET(url, otherParams);
};

/**
 * 我的-银行卡新增
 */
export const addBank = (otherParams) => {
	const url = '/api/userInfo/user/bank/add';

	return POST(url, otherParams, {
		header: {
			'content-Type': 'application/x-www-form-urlencoded'
		}
	});
};

/**
 * 获取银行卡背景颜色
 */
export const getBankBgColor = (otherParams = {}) => {
	const url = `webView/bankBgColor.json?v=${Date.now()}`;

	const defaulutObject = {
		data: null
	};

	return new Promise((resolve, reject) => {
		uni.request({
			url: `${defaultImageUrl}${url}`,
			success: (res) => {
				resolve(res?.data || defaulutObject);
			},
			fail: () => {
				resolve(defaulutObject);
			}
		});
	});
};

/**
 * 获取用户是否实名认证
 */
export const getUserInfoVerified = (otherParams = {}) => {
	const url = '/api/userInfo/user/identify/check';

	return GET(url, otherParams);
};

/**
 * 获取用户探店收益明细
 */
export const getAccountProfitLog = (otherParams = {}) => {
	const url = '/api/tdAccount/profitLog';

	return GET(url, otherParams);
};

/**
 * 获取用户提现记录
 */
export const getWithdrawalApply = (otherParams = {}) => {
	const url = '/api/withdrawalApply/log';

	return GET(url, otherParams);
};

/**
 * 获取用户提现记录
 */
export const getBalance = (otherParams = {}) => {
	const url = '/api/balance';

	return GET(url, otherParams);
};

/**
 * 提现申请
 */
export const withdrawalApply = (otherParams = {}) => {
	const url = '/api/withdrawalApply';

	return GET(url, otherParams);
};

/**
 * 实名认证信息
 */
export const setUserVerified = (otherParams = {}) => {
	const url = '/api/withdraw/account/verified';

	return POST(url, otherParams);
};

/**
 * 站内信全部已读
 * @param {*} params
 * @returns
 */
export const setAllMessageHaveread = (params) => {
	const url = '/api/message/allRead';

	return POST(url, params);
};

/**
 * 站内信分页列表
 * @param {*} params
 * @returns
 */
export const getCurrentTypeMessage = (params) => {
	const url = '/api/message/page';

	return GET(url, params, {
		custom: {
			// isFrom: true
		}
	});
};

/**
 * 站内信单条已读
 * @param {*} params
 * @returns
 */
export const setSingleMessageHaveread = (params) => {
	const url = '/api/message/oneRead';

	return GET(url, params);
};

/**
 * 未读站内信数量
 * @param {*} params
 * @returns
 */
export const getUnreadMessageNumber = (params) => {
	const url = '/api/message/count';

	return GET(url, params);
};

/**
 * 检查是否可以拓展达人
 * @param {*} params
 * @returns
 */
export const registerCheckOpen = (params) => {
	const url = '/api/register/checkOpen';
	return GET(url, params);
};

//检查注册
// mobile	 aUserId

export const checkRegisterUrl = (params) => {
	const url = '/api/register/checkRegister';

	return POST(url, params, {
		header: {
			'Content-type': 'application/x-www-form-urlencoded'
		}
	});
};

// 注册绑定
export const registerAndBindUrl = (otherParams) => {
	const url = '/api/register/registerAndBind';
	return POST(url, otherParams);
};
